﻿@using Web7.Container.Html
@using Web7.Core.Security

@model Web7.PagedList<Web7.Container.Models.User>

@{
    Layout = Html.GetManagementLayout();
    
    var userIndex = 0;
}
<style type="text/css">
	table.items {
       margin: 0 0 1.4em 0;
       background: white;
       border: 1px solid #EAEAEA;
       border-bottom: none;
       border-collapse: separate;
       border-spacing: 0;
       width: 100%;
    }
</style>
<div>
    <div >
        @T("用户列表")
    </div>
    <div >
        @Html.ActionLink(("创建").ToString(), "Create","User")
    </div>
    <fieldset>
    <table class="items">
        <thead>
            <tr>
                <th scope="col">&nbsp;&darr;</th>
                <th scope="col">@T("Name")</th>
                <th scope="col">@T("Email")</th>
                <th scope="col">@T("Actions")</th>
            </tr>
        </thead>
        @foreach (var entry in Model)
        {
            <tr>
                <td>
                    <input type="checkbox" value="true" name="" />
                </td>
                <td>@entry.UserName</td>
                <td>@entry.Email</td>
                <td>
                    @Html.ActionLink(T("Edit").ToString(), "Edit", new { entry.Id }) |
                    @Html.ActionLink(T("Delete").ToString(), "Delete", new { entry.Id }, new { itemprop = "RemoveUrl UnsafeUrl" })|
                    @if (entry.Status == UserStatus.PendingApproval) {
                        @Html.ActionLink(T("Approve").ToString(), "Approve", new { entry.Id })
                    } else {
                        @Html.ActionLink(T("Disable").ToString(), "Moderate", new {  entry.Id })
                    }|
                    @Html.ActionLink(T("Rights").ToString(), "Index", "PermissionRecord", new { OwnerType = PermissionOwnerType.User.ToString(), id = entry.Id }, null)
                    @if (entry.EmailStatus == UserStatus.PendingApproval) { <text>|</text>
                        @Html.ActionLink(T("Send challenge E-mail").ToString(), "SendChallengeEmail", new { entry.Id })
                    } 
                </td>
            </tr>
        }
    </table>
    </fieldset>
</div>